package com.xiaotao.realtimeui.runner;

import com.xiaotao.realtimeui.spark.StreamingProcessor;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class PaymentInfoConsumer implements ApplicationRunner, Runnable {
    @Resource
    private StreamingProcessor streamingProcessor;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        new Thread(this).start();
    }

    @Override
    public void run() {
        try {
            streamingProcessor.process();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
